function jslog(msg) 
{
    msg = msg + '\n';

    /* Various ways of debugging:
     *    1. window.dump 
     *          - prints to console/xterm
     *    2. Components.utils.reportError 
     *          - didn't work for me in firefox
     *          - prints exceptions/msgs to javascript error console
     *          as errors
     *    3. logStringMessage 
     *          - didn't work for me in firefox
     *      cls=Components.classes["@mozilla.org/consoleservice;1"];
     *      srv=cls.getService(Components.interfaces.nsIConsoleService);
     *      srv.logStringMessage(msg);
     *    4. alert
     *    5. firebug (look it up)
     */
    if( 'undefined' != window.opera && null != window.opera ) {
        // opera has a problem with window.dump
        opera.postError(msg);
    } else if ( navigator.userAgent.indexOf("MSIE") != -1 ) {
        // what to use on on IE ?
    } else {
        window.dump(msg);
    }
}
